


import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class GestureTest extends StatefulWidget {
  const GestureTest({super.key});

  @override
  State<GestureTest> createState() => _GestureTestState();
}

class _GestureTestState extends State<GestureTest> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: const Center(child: Text("canvas学习")),
      ),
      body: GestureDetector(
        onTap: () {
          print("触发外部探测器的单击事件");
        },
        child: Container(
          width: 200.0,
          height: 200.0,
          color: Colors.blue,
          child: Center(
            child: GestureDetector(
              onTap: () {
                print("触发内部探测器的单击事件");
              },
              child:  Container(
                width: 100.0,
                height: 100.0,
                color: Colors.red,
                child: const Center(child: Text('单击')),
              ),
            ),
          ),
        ),
      ),
    );
  }
}
